package com.huangmb.androidlib.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.huangmb.androidlib.utils.ScreenUtils;
import com.huangmb.androidlib.utils.ToastUtils;

public abstract class BaseActivity extends AppCompatActivity {

    protected abstract void onInitView(Bundle savedInstanceState);

    protected abstract void beforeInitView(Bundle savedInstanceState);

    protected abstract void afterInitView(Bundle savedInstanceState);

    @Override
    protected final void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        beforeInitView(savedInstanceState);
        onInitView(savedInstanceState);
        afterInitView(savedInstanceState);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
           }

    public float dip2px(float dp) {
        return ScreenUtils.dp2pxFloat(this, dp);
    }

    public float px2dip(float px) {
        return ScreenUtils.px2dpFloat(this, px);
    }

    public void toast(String msg){
        ToastUtils.showShort(this,msg);
    }


}
